﻿@{
    Layout = null;
}
@*少量装箱*@
<style>
    .form-horizontal .form-group {
        margin-bottom: 20px;
    }
</style>
<form class="form-horizontal" id="LittlePackForm" onkeydown="if(event.keyCode==13){return false;}">
    <input name="ID" id="ID" value="0" type="hidden" />
    <!--填写物流码-->
    <div class="form-group" style="display:flex;align-items:center;">
        <label class="btn btn-success">箱标号：</label>
        <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 ">
            <input type="text" id="BoxCode" name="BoxCode" class="form-control" autocomplete="off" placeholder="只能输入一个箱码，例如:0140052522447758" />
        </div>
    </div>
    <div class="form-group" style="display:flex;align-items:center;">
        <label class="btn btn-success">单标号：</label>
        <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 ">
            <textarea class="form-control" autocomplete="off" placeholder="格式说明：每行只能输入一个单标，然后以“，”结束。如下所示：
007010019969,007010019969,007010019969,007010019969,
                               " id="SingleCodes" name="SingleCodes" style="height: 148px" onkeypress="javascript: if (event.keyCode == 32) event.returnValue = false;" oninput="this.value = this.value.replace(/[\r\n]/g, ','); this.value = this.value.replace(/^ +| +$/g, '')"></textarea>
        </div>
    </div>
    <div class="row" style="display:flex;justify-content:center">
        <button type="button" class="btn btn-success" id="Next">开始</button>
    </div>
</form>
<script>
    $('#LittlePackForm').bootstrapValidator({
        //group:"#SingleCodesForm",
        fields: {
            BoxCode: {
                validators: {
                    notEmpty: {
                        message: '箱码不能为空'
                    },
                    //stringLength: {
                    //    min: 16,
                    //    message: '箱码长度必须大于16位'
                    //},
                    regexp: {
                        regexp:/^\d{16,}$/,
                        message:'只能输入大于16位的'
                    }
                }
            },
            SingleCodes: {
                validators: {
                    notEmpty: {
                        message: '箱码不能为空'
                    },
                }
            }
        }
    });

    $('#Next').click(function () {
        var bootstrapValidator = $("#LittlePackForm").data('bootstrapValidator').validate();
        if (bootstrapValidator.isValid()) {
            var ID = $("#ID").val();
            var BoxCode = $("#BoxCode").val();
            var SingleCodes = $("#SingleCodes").val();
            $.MGJ.PackBox.Ajax_LittlePacking({ 'ID': ID, 'BoxCode': BoxCode, 'SingleCodes': SingleCodes });
            $.MGJ.PackBox.Ajax_PackBoxPageList(1);//刷新列表
        }
        else {
            $.L.msgError("请检查数据格式！");
        };
    })
</script>
